package ca.cbc.medialib.entity;

import java.io.Serializable;

import javax.persistence.*;

/**
 * @author Arash Bizhanzadeh <arash.bizhan-zadeh@cbc.ca>
 *         Date: 02/06/11
 *         Time: 10:47 AM
 *         Copyrighted to CBC. All rights reserved.
 */
@Embeddable
public class Sponsor implements Serializable {
    /**
     *
     */
    private static final long serialVersionUID = -658809355051361335L;
    //	private long id;
    private String imageUrl;
    private String url;

    @SuppressWarnings("unused")
    private Sponsor() {
    }

    public Sponsor(String imageUrl, String url) {
        this.imageUrl = imageUrl;
        this.url = url;

    }

    public Sponsor(String imageUrl, String url, Category c) {
        this.imageUrl = imageUrl;
        this.url = url;

    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Sponsor linkImage = (Sponsor) o;

        if (imageUrl != null ? !imageUrl.equals(linkImage.imageUrl) : linkImage.imageUrl != null) return false;
        if (url != null ? !url.equals(linkImage.url) : linkImage.url != null) return false;

        return true;
    }


//	@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
//	public long getId() {
//		return id;
//	}

    public String getImageUrl() {
        return imageUrl;
    }


    public String getUrl() {
        return url;
    }

    @Override
    public int hashCode() {
        int result = imageUrl != null ? imageUrl.hashCode() : 0;
        result = 31 * result + (url != null ? url.hashCode() : 0);
        return result;

    }

    public void setImageUrl(String imageUrl) {
        this.imageUrl = imageUrl;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder();
        sb.append("Sponsor");
        sb.append(", imageUrl='").append(imageUrl).append('\'');
        sb.append(", url='").append(url).append('\'');
        sb.append('}');
        return sb.toString();
    }
}
